package database;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.sql.Statement;
import fingerprint.*;

public class SearchSF {

    Connect nc = new Connect();
    PreparedStatement pent = null;
    ResultSet res = null;
    String sql = null;
    Statement ent = null;

    public SearchSF() {
        nc.DConnect();
    }

  public ResultSet Searchfinger(int finger_id) {
        ResultSet resultSet = null;
        sql = "select id, offset from song_finger where finger_id="+String.valueOf(finger_id);
        try {
            resultSet = nc.nect.createStatement().executeQuery(sql);
            return resultSet;
        } catch (SQLException e1) {
            e1.printStackTrace();
        }
        return resultSet;
    }

    public  String SerachSong(int id) {
        String name = null;
        sql = "select name from song where id = " + id;
        try {
            ent = nc.nect.createStatement();
            res = ent.executeQuery(sql);
            if (res.next()) {
                name = res.getString("name");
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return name;
    }


}

